﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Imaginecup.gameState.malaria.componentInit;
using imaginecup.information;
using imaginecup.objectManager;
using Microsoft.Xna.Framework;

namespace Imaginecup.gameState.malaria.component.entity.fieldItem
{
    public class CmpFieldFlyPaper : BaseEntityComponent, ICmpChar
    {
        private List<ICmpMalaria> m_MalariaList;
        private double m_DelayTime;

        public CmpFieldFlyPaper(GObjectID a_GID, ObjectManager objMan)
            : base(a_GID, objMan, ComponentTypeID.CID_FIELD_ITEM_ENTITY)
        {
            m_MalariaList = new List<ICmpMalaria>();

        }

        public override void Update(GameTime gameTime)
        {
            m_DelayTime -= gameTime.ElapsedGameTime.TotalSeconds;

            if (m_DelayTime <= 0)
            {
                GMessage msg = new GMessage(MessageTypeID.MT_CHILD_DIE, m_ObjectID);
                m_ObjectMan.BroadCastMessage(msg);
                m_ObjectMan.DestroyObject(m_ObjectID);

            }

            else
            {
                GMessage Msg = new GMessage();
                Msg.m_Data = this;
                Msg.m_FromID = m_ObjectID;
                Msg.m_Type = MessageTypeID.MT_CHANGE_CHILDRENPOSITION;

                m_ObjectMan.BroadCastMessage(Msg);

            }
            base.Update(gameTime);
        }

        public override EMessageResult HandleMessage(GMessage a_Msg)
        {
            return base.HandleMessage(a_Msg);
        }


        public void SetDelayTime(double second)
        {
            m_DelayTime = second;
        }

        public int GetDemage()
        {
            return -1;
        }

        public void AddDemage(float Demage)
        {

        }

        public void SetShieldTime(double time)
        {

        }

        public void StartShieldItem()
        {
        }


        public bool GetShieldState()
        {
            throw new NotImplementedException();
        }
    }
}
